// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.modules.dao.impl;

import com.liuxinlong.modules.dao.UserMatterDao;
import com.liuxinlong.modules.entity.UserMatter;
import com.liuxinlong.modules.mapper.UserMatterMapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 类描述
 * <p>
 * 此类关联设计的功能
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2022年8月16日
 */
@Service
public class UserMatterDaoImpl extends ServiceImpl<UserMatterMapper, UserMatter> implements UserMatterDao {
    @Override
    public List<UserMatter> pageUserMatter(Map<String, Object> queryParam) {
        return baseMapper.pageUserMatter(queryParam);
    }

    @Override
    public int getUserMatterCount(Map<String, Object> queryParam) {
        return baseMapper.getUserMatterCount(queryParam);
    }

    @Override
    public UserMatter getBySourceId(String sourceId) {
        return baseMapper.getBySourceId(sourceId);
    }

    @Override
    public void updateAllState(String userId,String dealTime) {
        baseMapper.updateAllState(userId,dealTime);
    }

    @Override
    public List<UserMatter> getUserMatterBySource(String sourceId) {
        return baseMapper.getUserMatterBySource(sourceId);
    }

    @Override
    public Map<String, UserMatter> getSourceUserMatterMap(String sourceId) {
        List<UserMatter> list  = baseMapper.getUserMatterBySource(sourceId);
        Map<String,UserMatter> userMatterMap = new HashMap<>();
        for (UserMatter userMatter: list) {
            userMatterMap.put(userMatter.getPendingUser(),userMatter);
        }
        return userMatterMap;
    }
}
